package com.gh.controller;

import com.gh.result.Result;
import com.gh.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author Eric
 * @Date 2021/6/20 20:20
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/oss")
public class FileApiController {
    @Autowired
    private FileService fileService;

    @PostMapping("fileUpload")
    public Result fileUpload(MultipartFile file){
        String path = fileService.uploadFile(file);
        return Result.ok(path);
    }
}
